# -*- coding: utf-8 -*-
"""
@Version : 
@Author  : ChenMZ
@Time    : 2025/09/24
@File    : StaticModel.py
@Desc    : 
@Modify  : 
"""
from model.ViewModel import _BaseTableViewModel
from tool.signal_bus import CpuMonitorSignalBus


class CpuStaticInfoTableViewModel(_BaseTableViewModel):
    def __init__(self, headers: list):
        super().__init__(headers)
        CpuMonitorSignalBus.signal_get_attr_resp.connect(self.show_attr)

    def show_attr(self, attr: dict):
        self.update_data(attr['get_detail_info']())

    def update_data(self, data: dict):
        self.beginResetModel()
        self._data = [(k, v) for k, v in data.items()]
        self.endResetModel()

